//package com.wootion.dizhi.controller;
//
//import com.wootion.manhe.entity.FileResponse;
//import com.wootion.manhe.response.Result;
//import com.wootion.manhe.service.FileUploadService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//@Api(tags = "文件上传")
//@RestController
//@RequestMapping(path = {"/admin/system/upload"})
//public class FileUploadController {
//    @Resource
//    private FileUploadService fileUploadService;
//    /**
//     * 单文件上传
//     * @param file
//     * @return
//     */
//    @PostMapping("/uploadFile")
//    @ApiOperation("单文件上传")
//    public Result uploadFile(@RequestParam("file") MultipartFile file, HttpServletRequest httpServletRequest){
//        FileResponse fileResponse = fileUploadService.storageFile(file,httpServletRequest);
//        return Result.success(fileResponse);
//    }
//
//    /**
//     * 多文件上传
//     * @param files
//     * @return
//     */
//    @PostMapping("/uploadFiles")
//    @ApiOperation("多文件上传")
//    public Result uploadFiles(@RequestParam("files") MultipartFile[] files,HttpServletRequest httpServletRequest) {
//        List<FileResponse> fileResponses = new ArrayList<>();
//        Arrays.stream(files).forEach(file->{
//            FileResponse fileResponse = fileUploadService.storageFile(file,httpServletRequest);
//            fileResponses.add(fileResponse);
//        });
//        return Result.success(fileResponses);
//    }
//}
